<template>
    <div>
        <el-form   label-width="150px">
         <el-row>
        <el-col :span="7">
          <el-form-item label="合同编号">
            <el-input v-model="contratc.contract_id" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="合同文本编号">
            <el-input v-model="contratc.contract_textserial" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="合同分类">
            <el-select v-model="contratc.contract_contype" placeholder="请选择">
    <el-option
      v-for="item in contype"
      :key="item.contype_id"
      :label="item.contype_name"
      :value="item.contype_id">
    </el-option>
  </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-form-item label="合同名称" >
            <el-input v-model="contratc.contract_contname" ></el-input>
          </el-form-item>
      </el-row>
      <el-row>
        <el-col :span="7">
          <el-form-item label="建设单位">
            <el-input v-model="contratc.contract_conname" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="甲方类型">
           <dictionaryTableSelect
                  typeKey="firsttype"
                  :fieldValue.sync="customerInfo.c_firsttype"
                  
                ></dictionaryTableSelect>
          </el-form-item>
        </el-col>
      </el-row>
     <el-row>
        <el-col :span="10">
          <el-form-item label="建筑面积㎡" >
            <el-input v-model="contratc.contract_area" ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="7">
          <el-form-item label="工程负责人">
            <el-input v-model="contratc.contract_projectname" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="电话">
            <el-input v-model="contratc.contract_projecttell" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="子公司">
            <dictionaryTableSelect
                  typeKey="zicompany"
                  :fieldValue.sync="customerInfo.c_zicompany"
                  
                ></dictionaryTableSelect>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="7">
          <el-form-item label="甲方负责人" >
            <el-input v-model="contratc.contract_first_people" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="电话">
            <el-input v-model="contratc.contract_first_tell" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="工程地点" >
            <el-input v-model="contratc.contract_adder" ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="7">
          <el-form-item label="原始合同额(万元)" >
            <el-input v-model="contratc.contract_many" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="实际合同额(万元)" >
            <el-input v-model="contratc.contract_sjmany" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="合同签约日期">
            <el-input v-model="contratc.contract_time" type="date" ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="5">
          <el-form-item label="图纸套数总数">
            <el-input v-model="contratc.img_sum" ></el-input>
          </el-form-item>
           
        </el-col>
        <el-col :span="5">
          <el-form-item label="已出">
            <el-input v-model="contratc.img_sjsum" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="5">
          <el-form-item label="差旅次数总数">
            <el-input v-model="contratc.chai_sum" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="已出">
            <el-input v-model="contratc.chai_sjsum" ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="合同允许状态">
             <dictionaryTableSelect
                  typeKey="htzt"
                  :fieldValue.sync="customerInfo.c_htzt"
                ></dictionaryTableSelect>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
         <el-form-item label="合同备注">
            <el-input v-model="contratc.contract_reamk" ></el-input>
          </el-form-item>
      </el-row>
      <el-button @click="update">修改</el-button>
      </el-form>
    </div>
</template>

<script>
var lujing = "http://localhost:55117/api/Customer/";
var lujing1 = "http://localhost:55117/api/ContractControllers/";
export default {
  data() {
    return {
      form: {
        
      },
       cid:sessionStorage.getItem("cid"),
      AgreeInfo:{agreement_number:null},
        defaultProps: {
          children: 'sonList',
          label: 'structure_name'
        },
        shudata1:[],
        defaultProps1: {
          children: 'sonList',
          label: 'architecture_name'
        },
        chaData:{},
      contratc:{
        contract_zt:null,
        contract_zicompany:null,
        contract_first_type:null,
        contract_jgtype:null,
        contract_jzfl:null,
        contract_id:null,
      },
      customerInfo: {
        fileList: [],
        c_ketype: null,
        c_firsttype:null,
        c_zicompany:null,
        c_htzt:null,
      },
      
      City: [],
      province: [],
      tableData: [],
      dialogVisible: false,
      contype:[],
      
    };
  },
  components: {
    dictionaryTableSelect: () =>
      import("@/components/system_manager/DictionaryTableSelect"),
  },
  created() {
    this.getcontype();
    this.getShu();
    this.getshu1();
    this.getFan();
  },
  methods: {
    onSubmit() {
      console.log("submit!");
    },
    getFan(){
        this.$myaxios.get(lujing1+"FanAgree?id="+this.cid).then(obj=>{
           
            this.contratc=obj.data;
             this.customerInfo.c_firsttype=this.contratc.contract_first_type;
             this.customerInfo.c_zicompany=this.contratc.contract_zicompany;
             this.customerInfo.c_htzt=this.contratc.contract_zt;
            console.log(this.contratc);
        })
    },
    update(){
      this.$myaxios.post(lujing1+"UpdateContr",this.contratc).then(obj=>{
        if(obj.data!=null)
        {
          this.$message("修改成功");
          this.$router.push("/sys/COShow");
        }
      })
    }, 
    getcontype(){
      this.$myaxios.get(lujing1+"GetContype").then(obj=>{
        this.contype=obj.data;
      })
    },
   
    getShu(){
      this.$myaxios.get(lujing1+"GetStruct").then(obj=>{
        this.shudata=obj.data;
      })
    },
    getshu1()
    {
      this.$myaxios.get(lujing1+"GetArchite").then(obj=>{
        this.shudata1=obj.data;
      })
    },
     getCheckedKeys() {
        console.log(this.$refs.tree.getCheckedKeys());
      },
  },
};
</script>
